Add native reftable repository support - #2096
Conversation
f34e3ea to
b0b19ed
Compare
b0b19ed to
304e345
Compare
4e4fb59 to
8390a5c
Compare
5d5f8c3 to
f7dd841
Compare
f7dd841 to
857bfae
Compare
857bfae to
47abe06
Compare
47abe06 to
e6a9cc7
Compare
271d943 to
8f9b711
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Starting commit position of one checkout can be overwritten by another checkout's history in reftable repositories (src/daemon/ref_cursor.rs:343-362)
The starting position of the current checkout is picked from every checkout's recorded history at once (refs_at_command_start at src/daemon/ref_cursor.rs:343-362) instead of only the one the command ran in, so a command run in one working copy can be measured against another working copy's position and its changes attributed wrongly.
Impact: In repositories that use the new ref storage and have more than one working copy checked out, commits can be recorded against the wrong starting point, producing missing or incorrect AI/human attribution.
HEAD entries from several worktree stacks collapse onto one "HEAD" map key
RefCursor is per repo family and reftable_entries persists across commands. replace_reftable_stack_entries (src/daemon/ref_cursor.rs:273-289) only clears entries whose path equals the stack it just re-read, so after commands from both the main worktree and a linked worktree the map holds two distinct HEAD keys: head_key(common_git_dir) (materialized from the common stack) and head_key(linked_git_dir) (from .git/worktrees/<name>/reftable).
refs_at_command_start then iterates self.reftable_entries.values() and, for every group whose reference == "HEAD", resolves it with head_position — the offset captured for the current command's worktree — and inserts it under the literal key "HEAD". Because HashMap iteration order is unspecified, whichever HEAD group is visited last wins, so the returned snapshot can carry another worktree's HEAD OID.
The files-backed path does not have this problem: refs_at_reflog_start_offsets (src/daemon/ref_cursor.rs:2672-2695) iterates cmd.reflog_start_offsets, which only ever contains the current worktree's HEAD key.
The new integration test reftable_linked_worktree_uses_its_own_head_log does not exercise this because every command runs in the linked worktree, so common-stack HEAD entries are never materialized (main_worktree stays false and had_common_head stays false).
View 9 additional findings in Devin Review.
3383d41 to
164ed68
Compare
4317902 to
9313b87
Compare
9313b87 to
106a0a8
Compare
c3e2133 to
4bf3572
Compare
4bf3572 to
b23fc5d
Compare
b23fc5d to
8c56a2a
Compare
8c56a2a to
338eb23
Compare
338eb23 to
72295a7
Compare
Part 2 of 2 in the reftable support stack; depends on the async ingestion prerequisite.
Summary:
Tests: